/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('serverless', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model Application {
  autoDeploy?: string(name='autoDeploy', example='false'),
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='It\\"s a test'),
  envVars?: map[string]any(name='envVars'),
  lastRelease?: map[string]any(name='lastRelease'),
  name?: string(name='name', example='demo-app'),
  output?: map[string]any(name='output'),
  parameters?: map[string]any(name='parameters', example='{"region":"cn-hangzhou","serviceName":"web-framework","functionName":"kodbox"}'),
  repoSource?: {
    owner?: string(name='owner', example='zhangsan'),
    provider?: string(name='provider', example='github'),
    repo?: string(name='repo', example='application-center'),
  }(name='repoSource'),
  roleArn?: string(name='roleArn', example='acs:ram::{{accountId}}:role/aliyunfcserverlessdevsrole'),
  template?: string(name='template', example='devsapp/start-express'),
  trigger?: {
    branch?: string(name='branch', example='master'),
    commit?: string(name='commit'),
    on?: string(name='on', example='push'),
  }(name='trigger'),
  updatedTime?: string(name='updatedTime'),
  workDir?: string(name='workDir', example='code'),
}

model Condition {
  expression?: string(name='expression'),
}

model Context {
  data?: map[string]any(name='data'),
}

model ContextSchema {
  description?: string(name='description', example='[git](https://git-scm.com/) address for [git clone](https://git-scm.com/docs/git-clone).'),
  hint?: string(name='hint', example='git@gitlab.alibaba-inc.com:serverless/lambda.git'),
  name?: string(name='name', example='gitRepoUrl'),
  required?: boolean(name='required', example='true'),
  type?: string(name='type', example='string'),
}

model Environment {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  deletionTime?: string(name='deletionTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='It\\"s a test'),
  generation?: int32(name='generation', example='0'),
  kind?: string(name='kind', example='Environment'),
  name?: string(name='name', example='my-env'),
  spec?: EnvironmentSpec(name='spec'),
  status?: EnvironmentStatus(name='status'),
  uid?: string(name='uid', example='1455541096306548'),
}

model EnvironmentRevision {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  environmentGeneration?: int32(name='environmentGeneration', example='1'),
  environmentName?: string(name='environmentName', example='my-env'),
  kind?: string(name='kind', example='EnvironmentRevision'),
  spec?: EnvironmentSpec(name='spec'),
  status?: EnvironmentStatus(name='status'),
  uid?: string(name='uid', example='1455541096306548'),
}

model EnvironmentSpec {
  region?: string(name='region', example='cn-hangzhou'),
  roleArn?: string(name='roleArn', example='acs:ram::1455541096306548:role/aliyunfcdefaultrole'),
  template?: string(name='template', example='serverless-devs.com/alicloud-multi-functions/environment'),
  templateVariables?: map[string]any(name='templateVariables'),
  templateVersion?: int32(name='templateVersion', example='1'),
}

model EnvironmentStatus {
  message?: string(name='message', example='Success!'),
  observedGeneration?: int32(name='observedGeneration', example='0'),
  observedTime?: string(name='observedTime', example='2021-10-08T23:14:16Z'),
  output?: map[string]any(name='output'),
  phase?: string(name='phase', example='DeployFailed'),
}

model InputVariable {
  defaultJson?: string(name='defaultJson'),
  description?: string(name='description'),
  name?: string(name='name', example='namePrefix'),
  nullable?: boolean(name='nullable', example='true'),
  sensitive?: boolean(name='sensitive', example='false'),
  type?: string(name='type', example='string'),
}

model OutputValue {
  description?: string(name='description'),
  name?: string(name='name', example='vpcId'),
  sensitive?: boolean(name='sensitive', example='false'),
}

model Pipeline {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  deletionTime?: string(name='deletionTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='Pipeline example.'),
  generation?: int32(name='generation', example='1'),
  kind?: string(name='kind', example='Pipeline'),
  labels?: map[string]string(name='labels'),
  name?: string(name='name', example='my-pipeline'),
  resourceVersion?: int32(name='resourceVersion', example='1'),
  spec?: PipelineSpec(name='spec'),
  status?: PipelineStatus(name='status'),
  uid?: string(name='uid', example='1455541096***548'),
}

model PipelineSpec {
  context?: Context(name='context'),
  templateName?: string(name='templateName', example='my-pipeline-template'),
  templateSpec?: PipelineTemplateSpec(name='templateSpec'),
}

model PipelineStatus {
  latestExecError?: TaskExecError(name='latestExecError'),
  phase?: string(name='phase', example='Success'),
}

model PipelineTemplate {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  deletionTime?: string(name='deletionTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='PipelineTemplate example.'),
  generation?: int32(name='generation', example='1'),
  kind?: string(name='kind', example='PipelineTemplate'),
  labels?: map[string]string(name='labels'),
  name?: string(name='name', example='my-pipeline-template'),
  resourceVersion?: int32(name='resourceVersion', example='1'),
  spec?: PipelineTemplateSpec(name='spec'),
  uid?: string(name='uid', example='1455541096***548'),
}

model PipelineTemplateSpec {
  context?: Context(name='context'),
  tasks?: [
    TaskExec
  ](name='tasks'),
}

model Release {
  appConfig?: map[string]any(name='appConfig'),
  codeVersion?: {
    branch?: string(name='branch', example='master'),
    commit?: string(name='commit', example='b54850d'),
  }(name='codeVersion'),
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='It\\"s a test'),
  output?: map[string]any(name='output'),
  status?: string(name='status', example='published'),
  versionId?: long(name='versionId', example='1645539144303000'),
}

model RepoSource {
  owner?: string(name='owner'),
  provider?: string(name='provider', example='github'),
  repo?: string(name='repo'),
}

model RunAfter {
  name?: string(name='name', example='task-1'),
}

model Service {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  deletionTime?: string(name='deletionTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='It\\"s a test'),
  generation?: int32(name='generation', example='0'),
  kind?: string(name='kind', example='Service'),
  name?: string(name='name', example='my-service'),
  spec?: ServiceSpec(name='spec'),
  status?: ServiceStatus(name='status'),
  uid?: string(name='uid', example='1455541096306548'),
}

model ServiceRevision {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  kind?: string(name='kind', example='ServiceRevision'),
  serviceGeneration?: int32(name='serviceGeneration', example='1'),
  serviceName?: string(name='serviceName', example='my-service'),
  spec?: ServiceSpec(name='spec'),
  status?: EnvironmentStatus(name='status'),
  uid?: string(name='uid', example='1455541096306548'),
}

model ServiceSpec {
  environment?: string(name='environment', example='my-env'),
  roleArn?: string(name='roleArn', example='acs:ram::1455541096306548:role/aliyunfcdefaultrole'),
  template?: string(name='template', example='serverless-devs.com/alicloud-multi-functions/service-single-function/deployment'),
  templateVariables?: map[string]any(name='templateVariables'),
  templateVersion?: int32(name='templateVersion', example='1'),
}

model ServiceStatus {
  message?: string(name='message', example='Success!'),
  observedGeneration?: int32(name='observedGeneration', example='0'),
  observedTime?: string(name='observedTime', example='2021-10-08T23:14:16Z'),
  output?: map[string]any(name='output'),
  phase?: string(name='phase', example='DeployFailed'),
}

model Status {
  code?: string(name='code', example='IllegalStateException'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  success?: boolean(name='success', example='true'),
}

model StsCredentials {
  accessKeyId?: string(name='accessKeyId', example='STS.NUsVDrK7D4sFsGdAGZSxrHVQ8'),
  expirationTime?: string(name='expirationTime', example='2021-11-22T21:30:35Z'),
  kind?: string(name='kind', example='StsCredentials'),
  secretAccessKey?: string(name='secretAccessKey', example='Lr4F1rPGxm2tYchxw5ivfByEHg5Njepnw1hkVRrsgnuJ'),
  token?: string(name='token', example='CAISlgJ1q6Ft5B2yfSjIr5bGHf7Gpuhlg7GtcWHVpUcPX/dep5P62jz2IHFOfHVoCO4XsfUxnGxV5/sdlo0uGpEUSBydYI4tvsQJtF+oPdWE6sLusvkOhcX5FDSaVk7y1ZGKpxAq6G+aKJmXcFnhunJZ49mTLEePPTGMNZmOluQUDLA+VRW5ajxrHcpfIhAYxuYRKXrWM4TGUHeo+B2yanBloQ1hk2hyxL2iy8mHkHrkgUb91/UeqvaaQPHmTbE1YMoiDovshL0oKvKfjXIA0XUQqvcq1p4j0Czco9SQD2NW5xi7KOfO+rVtVlQoPPBmQ/8a/aety6Uk572OyJ6MwhJMLPxTXS/TSY6p3c/YAuStO8aH+Dd8t+ksuRqAAQOB+I8Ptc5S+tc8qHe1Hru7jRh7oYOAIM9JDlbwX484NqbbCw15Qc+pcuBGec3yY4EY9/fO9jpkInSK6HLNmNTP2/PYp/PaKqb00Sb3pAeGo4YOyImWE8jyhB3Sn4wOZtWKPcvxI9+ntdPKu9GdOXU1jpQgBIzIkjY8pfqONI8n'),
}

model Task {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  deletionTime?: string(name='deletionTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='Task example.'),
  generation?: int32(name='generation', example='1'),
  kind?: string(name='kind', example='Task'),
  labels?: map[string]string(name='labels'),
  name?: string(name='name', example='my-task'),
  resourceVersion?: int32(name='resourceVersion', example='1'),
  spec?: TaskSpec(name='spec'),
  status?: TaskStatus(name='status'),
  uid?: string(name='uid', example='1455541096***548'),
}

model TaskExec {
  context?: Context(name='context'),
  name?: string(name='name', example='task-1'),
  runAfters?: [
    RunAfter
  ](name='runAfters'),
  taskTemplate?: string(name='taskTemplate', example='serverless-runner'),
}

model TaskExecError {
  code?: string(name='code', example='AccessDenied'),
  extraInfo?: string(name='extraInfo', example='部署辅助函数权限不足，需要添加额外的权限以解决问题。https://help.aliyun.com'),
  message?: string(name='message', example='部署服务[_appcenter-xxx]失败，权限不足'),
  requestId?: string(name='requestId', example='1-26d1287xxxxx'),
  title?: string(name='title', example='权限不足错误'),
}

model TaskInvocation {
  instanceID?: string(name='instanceID', example='c-nkj8shz7xxxx'),
  invocationID?: string(name='invocationID', example='E099843B-10A2-4936-9964-4E0EE263D564'),
  invocationTarget?: string(name='invocationTarget', example='acs:fc:cn-hangzhou:143xxxx:services/xxx.LATEST/functions/xxx'),
  output?: string(name='output', example='{"key1":"value1","key2":"value2"}'),
  requestID?: string(name='requestID', example='1B3058B1-F1C9-457C-B95C-2C250A4B3118'),
  slsLogStore?: string(name='slsLogStore', example='my-sls-logstore'),
  slsProject?: string(name='slsProject', example='my-sls-project'),
  status?: string(name='status', example='success'),
}

model TaskSpec {
  context?: Context(name='context'),
  templateName?: string(name='templateName', example='my-task-template'),
}

model TaskStatus {
  executionDetails?: [ string ](name='executionDetails'),
  invocations?: [
    TaskInvocation
  ](name='invocations'),
  latestExecError?: TaskExecError(name='latestExecError'),
  phase?: string(name='phase', example='Success'),
  statusGeneration?: long(name='statusGeneration', example='123'),
}

model TaskTemplate {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  deletionTime?: string(name='deletionTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='TaskTemplate example.'),
  generation?: int32(name='generation', example='1'),
  kind?: string(name='kind', example='TaskTemplate'),
  labels?: map[string]string(name='labels'),
  name?: string(name='name', example='my-task-template'),
  resourceVersion?: int32(name='resourceVersion', example='1'),
  spec?: TaskTemplateSpec(name='spec'),
  uid?: string(name='uid', example='1455541096***548'),
}

model TaskTemplateSpec {
  context?: Context(name='context'),
  description?: string(name='description', example='build&deploy.'),
  executeCondition?: Condition(name='executeCondition'),
  worker?: TaskWorker(name='worker'),
}

model TaskWorker {
  presetWorker?: string(name='presetWorker', example='serverless-runner'),
}

model Template {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  deletionTime?: string(name='deletionTime', example='2021-11-19T09:34:38Z'),
  description?: string(name='description', example='It\\"s a test'),
  generation?: int32(name='generation', example='0'),
  kind?: string(name='kind', example='Template'),
  name?: string(name='name', example='my-tpl'),
  spec?: TemplateSpec(name='spec'),
  status?: TemplateStatus(name='status'),
  uid?: string(name='uid', example='1455541096306548'),
  version?: int32(name='version', example='1'),
}

model TemplateRevision {
  createdTime?: string(name='createdTime', example='2021-11-19T09:34:38Z'),
  kind?: string(name='kind', example='TemplateRevision'),
  spec?: TemplateSpec(name='spec'),
  status?: TemplateStatus(name='status'),
  templateGeneration?: int32(name='templateGeneration', example='1'),
  templateName?: string(name='templateName', example='my-template'),
  templateVersion?: int32(name='templateVersion', example='1'),
  uid?: string(name='uid', example='1455541096306548'),
}

model TemplateSpec {
  content?: string(name='content'),
  contentType?: string(name='contentType', example='application/hcl+terraform'),
  ramPolicy?: string(name='ramPolicy', example='{"Statement":[{"Action":"*","Effect":"Allow","Resource":"*"}],"Version":"1"}'),
  type?: string(name='type', example='Environment'),
}

model TemplateStatus {
  message?: string(name='message'),
  observedGeneration?: int32(name='observedGeneration', example='0'),
  observedTime?: string(name='observedTime', example='2021-10-08T23:14:16Z'),
  outputs?: [
    OutputValue
  ](name='outputs'),
  phase?: string(name='phase'),
  variables?: [
    InputVariable
  ](name='variables'),
}

model TriggerConfig {
  branch?: string(name='branch'),
  commit?: string(name='commit'),
  on?: string(name='on'),
}

model CancelTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Task  
}

async function cancelTaskWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): CancelTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CancelTask',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks/${OpenApiUtil.getEncodeParam(name)}/cancel`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function cancelTask(name: string): CancelTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return cancelTaskWithOptions(name, headers, runtime);
}

model CreateApplicationRequest {
  autoDeploy?: boolean(name='autoDeploy'),
  description?: string(name='description'),
  envVars?: map[string]string(name='envVars'),
  name?: string(name='name'),
  parameters?: map[string]string(name='parameters'),
  repoSource?: RepoSource(name='repoSource'),
  roleArn?: string(name='roleArn'),
  template?: string(name='template'),
  trigger?: TriggerConfig(name='trigger'),
}

model CreateApplicationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Application  
}

async function createApplicationWithOptions(request: CreateApplicationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateApplicationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.autoDeploy)) {
    body['autoDeploy'] = request.autoDeploy;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.envVars)) {
    body['envVars'] = request.envVars;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }
  if (!Util.isUnset(request.parameters)) {
    body['parameters'] = request.parameters;
  }
  if (!Util.isUnset(request.repoSource)) {
    body['repoSource'] = request.repoSource;
  }
  if (!Util.isUnset(request.roleArn)) {
    body['roleArn'] = request.roleArn;
  }
  if (!Util.isUnset(request.template)) {
    body['template'] = request.template;
  }
  if (!Util.isUnset(request.trigger)) {
    body['trigger'] = request.trigger;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateApplication',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/applications`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createApplication(request: CreateApplicationRequest): CreateApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createApplicationWithOptions(request, headers, runtime);
}

model CreatePipelineRequest {
  body?: Pipeline(name='body'),
}

model CreatePipelineResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Pipeline  
}

async function createPipelineWithOptions(request: CreatePipelineRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePipelineResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePipeline',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelines`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPipeline(request: CreatePipelineRequest): CreatePipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPipelineWithOptions(request, headers, runtime);
}

model CreatePipelineTemplateRequest {
  body?: PipelineTemplate(name='body'),
}

model CreatePipelineTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PipelineTemplate  
}

async function createPipelineTemplateWithOptions(request: CreatePipelineTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePipelineTemplateResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePipelineTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelinetemplates`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPipelineTemplate(request: CreatePipelineTemplateRequest): CreatePipelineTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPipelineTemplateWithOptions(request, headers, runtime);
}

model CreateReleaseRequest {
  description?: string(name='description'),
}

model CreateReleaseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Release  
}

async function createReleaseWithOptions(appName: string, request: CreateReleaseRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateReleaseResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    query['description'] = request.description;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateRelease',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/applications/${OpenApiUtil.getEncodeParam(appName)}/releases`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createRelease(appName: string, request: CreateReleaseRequest): CreateReleaseResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createReleaseWithOptions(appName, request, headers, runtime);
}

model CreateTaskRequest {
  body?: Task(name='body'),
}

model CreateTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Task  
}

async function createTaskWithOptions(request: CreateTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTaskResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTask',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTask(request: CreateTaskRequest): CreateTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTaskWithOptions(request, headers, runtime);
}

model CreateTaskTemplateRequest {
  body?: TaskTemplate(name='body'),
}

model CreateTaskTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TaskTemplate  
}

async function createTaskTemplateWithOptions(request: CreateTaskTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTaskTemplateResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTaskTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasktemplates`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTaskTemplate(request: CreateTaskTemplateRequest): CreateTaskTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTaskTemplateWithOptions(request, headers, runtime);
}

model DeleteApplicationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: string(name='body'),
}

async function deleteApplicationWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteApplicationResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteApplication',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/applications/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'string',
  };
  return callApi(params, req, runtime);
}

async function deleteApplication(name: string): DeleteApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteApplicationWithOptions(name, headers, runtime);
}

model DeleteEnvironmentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function deleteEnvironmentWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteEnvironmentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteEnvironment',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/environments/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteEnvironment(name: string): DeleteEnvironmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteEnvironmentWithOptions(name, headers, runtime);
}

model DeletePipelineTemplateResponseBody = {
  requestId?: string(name='requestId'),
}

model DeletePipelineTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePipelineTemplateResponseBody(name='body'),
}

async function deletePipelineTemplateWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeletePipelineTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeletePipelineTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelinetemplates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePipelineTemplate(name: string): DeletePipelineTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deletePipelineTemplateWithOptions(name, headers, runtime);
}

model DeleteTaskTemplateResponseBody = {
  requestId?: string(name='requestId'),
}

model DeleteTaskTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteTaskTemplateResponseBody(name='body'),
}

async function deleteTaskTemplateWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTaskTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTaskTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasktemplates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteTaskTemplate(name: string): DeleteTaskTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTaskTemplateWithOptions(name, headers, runtime);
}

model DeleteTemplateRequest {
  version?: int32(name='version', example='1'),
}

model DeleteTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Status  
}

async function deleteTemplateWithOptions(name: string, request: DeleteTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTemplateResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.version)) {
    query['version'] = request.version;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/templates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteTemplate(name: string, request: DeleteTemplateRequest): DeleteTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTemplateWithOptions(name, request, headers, runtime);
}

model GetApplicationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Application  
}

async function getApplicationWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetApplicationResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetApplication',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/applications/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getApplication(name: string): GetApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getApplicationWithOptions(name, headers, runtime);
}

model GetEnvironmentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Environment  
}

async function getEnvironmentWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetEnvironmentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetEnvironment',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/environments/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getEnvironment(name: string): GetEnvironmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getEnvironmentWithOptions(name, headers, runtime);
}

model GetPipelineResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Pipeline  
}

async function getPipelineWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPipelineResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetPipeline',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelines/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPipeline(name: string): GetPipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPipelineWithOptions(name, headers, runtime);
}

model GetPipelineTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PipelineTemplate  
}

async function getPipelineTemplateWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPipelineTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetPipelineTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelinetemplates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPipelineTemplate(name: string): GetPipelineTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPipelineTemplateWithOptions(name, headers, runtime);
}

model GetReleaseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Release  
}

async function getReleaseWithOptions(appName: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetReleaseResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetRelease',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/applications/${OpenApiUtil.getEncodeParam(appName)}/releases/${OpenApiUtil.getEncodeParam(versionId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRelease(appName: string, versionId: string): GetReleaseResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getReleaseWithOptions(appName, versionId, headers, runtime);
}

model GetServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Service  
}

async function getServiceWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetServiceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetService',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/services/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getService(name: string): GetServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getServiceWithOptions(name, headers, runtime);
}

model GetTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Task  
}

async function getTaskWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTask',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTask(name: string): GetTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskWithOptions(name, headers, runtime);
}

model GetTaskTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TaskTemplate  
}

async function getTaskTemplateWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTaskTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasktemplates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTaskTemplate(name: string): GetTaskTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskTemplateWithOptions(name, headers, runtime);
}

model GetTemplateRequest {
  version?: int32(name='version', example='1'),
}

model GetTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Template  
}

async function getTemplateWithOptions(name: string, request: GetTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTemplateResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.version)) {
    query['version'] = request.version;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/templates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTemplate(name: string, request: GetTemplateRequest): GetTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTemplateWithOptions(name, request, headers, runtime);
}

model ListApplicationsRequest {
  currentPage?: string(name='currentPage'),
  filterName?: string(name='filterName'),
  pageSize?: string(name='pageSize'),
  template?: string(name='template'),
}

model ListApplicationsResponseBody = {
  currentPage?: string(name='currentPage'),
  result?: [
    Application
  ](name='result'),
  totalCount?: string(name='totalCount'),
}

model ListApplicationsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListApplicationsResponseBody(name='body'),
}

async function listApplicationsWithOptions(request: ListApplicationsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListApplicationsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    query['currentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.filterName)) {
    query['filterName'] = request.filterName;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.template)) {
    query['template'] = request.template;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListApplications',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/applications`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listApplications(request: ListApplicationsRequest): ListApplicationsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listApplicationsWithOptions(request, headers, runtime);
}

model ListEnvironmentRevisionsRequest {
  environmentName?: string(name='environmentName', example='my-env'),
}

model ListEnvironmentRevisionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    EnvironmentRevision
  ](name='body'),
}

async function listEnvironmentRevisionsWithOptions(request: ListEnvironmentRevisionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListEnvironmentRevisionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.environmentName)) {
    query['environmentName'] = request.environmentName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListEnvironmentRevisions',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/environmentrevisions/`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listEnvironmentRevisions(request: ListEnvironmentRevisionsRequest): ListEnvironmentRevisionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listEnvironmentRevisionsWithOptions(request, headers, runtime);
}

model ListEnvironmentsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    Environment
  ](name='body'),
}

async function listEnvironmentsWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListEnvironmentsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListEnvironments',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/environments/`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listEnvironments(): ListEnvironmentsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listEnvironmentsWithOptions(headers, runtime);
}

model ListPipelineTemplatesRequest {
  labelSelector?: [ string ](name='labelSelector'),
}

model ListPipelineTemplatesShrinkRequest {
  labelSelectorShrink?: string(name='labelSelector'),
}

model ListPipelineTemplatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    PipelineTemplate
  ](name='body'),
}

async function listPipelineTemplatesWithOptions(tmpReq: ListPipelineTemplatesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelineTemplatesResponse {
  Util.validateModel(tmpReq);
  var request = new ListPipelineTemplatesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.labelSelector)) {
    request.labelSelectorShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.labelSelector, 'labelSelector', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.labelSelectorShrink)) {
    query['labelSelector'] = request.labelSelectorShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelineTemplates',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelinetemplates`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listPipelineTemplates(request: ListPipelineTemplatesRequest): ListPipelineTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelineTemplatesWithOptions(request, headers, runtime);
}

model ListPipelinesRequest {
  labelSelector?: [ string ](name='labelSelector'),
}

model ListPipelinesShrinkRequest {
  labelSelectorShrink?: string(name='labelSelector'),
}

model ListPipelinesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    Pipeline
  ](name='body'),
}

async function listPipelinesWithOptions(tmpReq: ListPipelinesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelinesResponse {
  Util.validateModel(tmpReq);
  var request = new ListPipelinesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.labelSelector)) {
    request.labelSelectorShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.labelSelector, 'labelSelector', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.labelSelectorShrink)) {
    query['labelSelector'] = request.labelSelectorShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelines',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelines`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listPipelines(request: ListPipelinesRequest): ListPipelinesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelinesWithOptions(request, headers, runtime);
}

model ListServiceRevisionsRequest {
  serviceName?: string(name='serviceName', example='my-service'),
}

model ListServiceRevisionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    ServiceRevision
  ](name='body'),
}

async function listServiceRevisionsWithOptions(request: ListServiceRevisionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListServiceRevisionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.serviceName)) {
    query['serviceName'] = request.serviceName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListServiceRevisions',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/servicerevisions/`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listServiceRevisions(request: ListServiceRevisionsRequest): ListServiceRevisionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listServiceRevisionsWithOptions(request, headers, runtime);
}

model ListServicesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    Service
  ](name='body'),
}

async function listServicesWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListServicesResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListServices',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/services/`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listServices(): ListServicesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listServicesWithOptions(headers, runtime);
}

model ListTaskTemplatesRequest {
  labelSelector?: [ string ](name='labelSelector'),
}

model ListTaskTemplatesShrinkRequest {
  labelSelectorShrink?: string(name='labelSelector'),
}

model ListTaskTemplatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    TaskTemplate
  ](name='body'),
}

async function listTaskTemplatesWithOptions(tmpReq: ListTaskTemplatesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTaskTemplatesResponse {
  Util.validateModel(tmpReq);
  var request = new ListTaskTemplatesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.labelSelector)) {
    request.labelSelectorShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.labelSelector, 'labelSelector', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.labelSelectorShrink)) {
    query['labelSelector'] = request.labelSelectorShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTaskTemplates',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasktemplates`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listTaskTemplates(request: ListTaskTemplatesRequest): ListTaskTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTaskTemplatesWithOptions(request, headers, runtime);
}

model ListTasksRequest {
  labelSelector?: [ string ](name='labelSelector'),
}

model ListTasksShrinkRequest {
  labelSelectorShrink?: string(name='labelSelector'),
}

model ListTasksResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    Task
  ](name='body'),
}

async function listTasksWithOptions(tmpReq: ListTasksRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTasksResponse {
  Util.validateModel(tmpReq);
  var request = new ListTasksShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.labelSelector)) {
    request.labelSelectorShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.labelSelector, 'labelSelector', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.labelSelectorShrink)) {
    query['labelSelector'] = request.labelSelectorShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTasks',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listTasks(request: ListTasksRequest): ListTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTasksWithOptions(request, headers, runtime);
}

model ListTemplateRevisionsRequest {
  templateName?: string(name='templateName', example='my-template'),
  templateVersion?: int32(name='templateVersion', example='1'),
}

model ListTemplateRevisionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    TemplateRevision
  ](name='body'),
}

async function listTemplateRevisionsWithOptions(request: ListTemplateRevisionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTemplateRevisionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.templateName)) {
    query['templateName'] = request.templateName;
  }
  if (!Util.isUnset(request.templateVersion)) {
    query['templateVersion'] = request.templateVersion;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTemplateRevisions',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/templaterevisions/`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listTemplateRevisions(request: ListTemplateRevisionsRequest): ListTemplateRevisionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTemplateRevisionsWithOptions(request, headers, runtime);
}

model ListTemplatesRequest {
  type?: string(name='type', example='Environment'),
}

model ListTemplatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: [
    Template
  ](name='body'),
}

async function listTemplatesWithOptions(request: ListTemplatesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTemplatesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTemplates',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/templates/`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'array',
  };
  return callApi(params, req, runtime);
}

async function listTemplates(request: ListTemplatesRequest): ListTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTemplatesWithOptions(request, headers, runtime);
}

model PutEnvironmentRequest {
  body?: Environment(name='body'),
}

model PutEnvironmentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Environment  
}

async function putEnvironmentWithOptions(name: string, request: PutEnvironmentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PutEnvironmentResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PutEnvironment',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/environments/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putEnvironment(name: string, request: PutEnvironmentRequest): PutEnvironmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return putEnvironmentWithOptions(name, request, headers, runtime);
}

model PutPipelineStatusRequest {
  body?: Pipeline(name='body'),
  force?: boolean(name='force'),
}

model PutPipelineStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Pipeline  
}

async function putPipelineStatusWithOptions(name: string, request: PutPipelineStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PutPipelineStatusResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.force)) {
    query['force'] = request.force;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PutPipelineStatus',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelines/${OpenApiUtil.getEncodeParam(name)}/status`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putPipelineStatus(name: string, request: PutPipelineStatusRequest): PutPipelineStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return putPipelineStatusWithOptions(name, request, headers, runtime);
}

model PutPipelineTemplateRequest {
  body?: PipelineTemplate(name='body'),
  force?: boolean(name='force'),
}

model PutPipelineTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PipelineTemplate  
}

async function putPipelineTemplateWithOptions(name: string, request: PutPipelineTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PutPipelineTemplateResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.force)) {
    query['force'] = request.force;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PutPipelineTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelinetemplates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putPipelineTemplate(name: string, request: PutPipelineTemplateRequest): PutPipelineTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return putPipelineTemplateWithOptions(name, request, headers, runtime);
}

model PutServiceRequest {
  body?: Service(name='body'),
}

model PutServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Service  
}

async function putServiceWithOptions(name: string, request: PutServiceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PutServiceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PutService',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/services/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putService(name: string, request: PutServiceRequest): PutServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return putServiceWithOptions(name, request, headers, runtime);
}

model PutTaskStatusRequest {
  body?: Task(name='body'),
  force?: boolean(name='force'),
}

model PutTaskStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Task  
}

async function putTaskStatusWithOptions(name: string, request: PutTaskStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PutTaskStatusResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.force)) {
    query['force'] = request.force;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PutTaskStatus',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks/${OpenApiUtil.getEncodeParam(name)}/status`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putTaskStatus(name: string, request: PutTaskStatusRequest): PutTaskStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return putTaskStatusWithOptions(name, request, headers, runtime);
}

model PutTaskTemplateRequest {
  body?: TaskTemplate(name='body'),
  force?: boolean(name='force'),
}

model PutTaskTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TaskTemplate  
}

async function putTaskTemplateWithOptions(name: string, request: PutTaskTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PutTaskTemplateResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.force)) {
    query['force'] = request.force;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PutTaskTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasktemplates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putTaskTemplate(name: string, request: PutTaskTemplateRequest): PutTaskTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return putTaskTemplateWithOptions(name, request, headers, runtime);
}

model PutTemplateRequest {
  body?: Template(name='body'),
  version?: int32(name='version', example='1'),
}

model PutTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Template  
}

async function putTemplateWithOptions(name: string, request: PutTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PutTemplateResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.version)) {
    query['version'] = request.version;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PutTemplate',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/templates/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putTemplate(name: string, request: PutTemplateRequest): PutTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return putTemplateWithOptions(name, request, headers, runtime);
}

model ResumeTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Task  
}

async function resumeTaskWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): ResumeTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ResumeTask',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks/${OpenApiUtil.getEncodeParam(name)}/resume`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resumeTask(name: string): ResumeTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return resumeTaskWithOptions(name, headers, runtime);
}

model RetryTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Task  
}

async function retryTaskWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): RetryTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RetryTask',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks/${OpenApiUtil.getEncodeParam(name)}/retry`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function retryTask(name: string): RetryTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return retryTaskWithOptions(name, headers, runtime);
}

model StartPipelineResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Pipeline  
}

async function startPipelineWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): StartPipelineResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StartPipeline',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/pipelines/${OpenApiUtil.getEncodeParam(name)}/start`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startPipeline(name: string): StartPipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return startPipelineWithOptions(name, headers, runtime);
}

model StartTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Task  
}

async function startTaskWithOptions(name: string, headers: map[string]string, runtime: Util.RuntimeOptions): StartTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StartTask',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/tasks/${OpenApiUtil.getEncodeParam(name)}/start`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startTask(name: string): StartTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return startTaskWithOptions(name, headers, runtime);
}

model UpdateApplicationRequest {
  body?: Application(name='body'),
}

model UpdateApplicationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: Application  
}

async function updateApplicationWithOptions(name: string, request: UpdateApplicationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateApplicationResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateApplication',
    version = '2021-09-24',
    protocol = 'HTTPS',
    pathname = `/apis/serverlessdeployment/v1/applications/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateApplication(name: string, request: UpdateApplicationRequest): UpdateApplicationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateApplicationWithOptions(name, request, headers, runtime);
}

